<?php
/***************************************************************************
 * 
 * Copyright (c) 2010 , Inc. All Rights Reserved
 * $Id$:Conf.php,2010/05/13 13:28:42 
 * 
 **************************************************************************/
 
 
 
/**
 * @file Conf.php
 * @author huqingping
 * @date 2010/05/13 13:28:42
 * @version 1.0 
 * @brief 
 *  
 **/

final class Conf
{
	static function load($paths)
	{
		if (is_string($paths)) {
			$paths = array($paths);
		}
		foreach($paths as $path) {
			if (isset(self::$isLoaded[$path])) {
				continue;
			}
			if (is_readable($path)) {
				require_once $path;
				self::$isLoaded[$path] = true;
			} else {
		//有人说这条信息太多，建议不要了
		//		trigger_error("$path no such file or directory",E_USER_NOTICE);
			}
		}
	}

	private static $isLoaded = array();
	private static $confData = array();

	static function get($key,$default=null)
	{
		if (isset(self::$confData[$key])) {
			return self::$confData[$key];
		}
		return $default;
	}

	static function set($key,$value)
	{
		self::$confData[$key] = $value;
	}

	static function has($key)
	{
		return isset(self::$confData[$key]);
	}

	static function clear()
	{
		self::$isLoaded = array();
		self::$confData = array();
	}
}






/* vim: set ts=4 sw=4 sts=4 tw=100 noet: */
